import { post, get, put, del, httpRequest } from '@/http/request'
import { DictItem } from '@/types/dict'

export const fetchTree = (dictCode: string) => {
  return post<DictItem>('/dict/getDicDataCode', { dictCode })
}

/**修改字典接口 */
export const updateDictService = (data: DictItem) => {
  return put('/dict/updateDicData', data)
}
/**新增字典接口 */
export const addDictService = (data: DictItem) => {
  return post('/dict/addDicData', data)
}
/**
 * 删除字典接口
 * @param ids 字典ID
 */
export const deleteDicData = (data: string[]) => {
  return post('/dict/deleteDicData', { ids: data })
}

/**
 * 字典排序接口
 * @param data 排序数据
 */
export const sortDictService = (data: { id: string; sort: number }) => {
  return put('/dict/sortDicData', data)
}
